#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
@author: DDD
@file: main.py
@time: 2022/5/13 14:58
"""
from flask import Flask,render_template
app = Flask(__name__,template_folder='temp')

@app.route('/')
def index():
    name='ddd'
    user='貂蝉'
    data = {
        'key':'python',
        'array':[1,1,3,4,5,6],
        'dicts':{
            'name':'laowang',
            'age':20
        },
        'info':[
            {
                'name':'西施',
                'age':18
            },{
                'name':'王昭君',
                'age':19
            }
        ]
    }

    return render_template('index.html',name=name,data=data,user=user)


# 自定义过滤器
@app.template_filter('lireverse')
def do_lireverse(li):

    temp_li = list(li)
    temp_li.reverse()
    return temp_li

@app.route('/base')
def base():
    return render_template('base.html')
@app.route('/ch')
def ch():
    return render_template('child.html')

if __name__ == '__main__':
    app.run(port=8888)